<template>
  <svg aria-hidden="true" @click="$emit('click', $event)" class="svg-icon" :style="{color, width: size + 'px', height: size + 'px'}">
    <use :href="iconName" />
  </svg>
</template>

<script>
export default {
  name: 'svg-icon',
  props: {
    iconClass: {
      type: String,
      required: true
    },
    color: {
      type: String,
      default: 'cornflowerblue'
    },
    size: {
      type: Number,
      default: 16
    }
  },
  computed: {
    iconName() {
      return `#icon-${this.iconClass}`
    }
  }
}
</script>

<style lang="scss" scoped>
.svg-icon{
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
